
import http from '@/utils/http'

const BASE_URL = '/task/loc'


export interface LocationOption {
  id: string
  name: string
}

export interface Result<T = any> {
  code: number;
  message: string;  
  data: T;
  success: boolean; 
  timestamp: number;
}


/** 搜索位置 */
export function searchLocs() {
  return http.get<Result<LocationOption[]>>(`/task/loc/searchAny`)
    .then(res => {
      if (res.success) {
        return res.data.data;
      }
      throw new Error(res.msg || '搜索位置失败');
    })
    .catch(error => {
      console.error('搜索位置网络请求失败:', error);
      throw error;
    });
}